﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


public partial class _Default : System.Web.UI.Page
{

	protected void cmdBrowse_Click(object sender, EventArgs e)
    {
        Response.Redirect("Items.aspx");        
    }
    
    protected void cmdEndingAuctions_Click(object sender, EventArgs e)
    {
        Session["ListingType"] = "AuctionsEndingSoon";
        Response.Redirect("List.aspx");
    }

    protected void cmdCurrentAuctions_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/CurrentAuctions.aspx");
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userID"] == null)
        {
            cmdBrowse.Enabled = false;
            cmdBrowse.ControlStyle.CssClass = "DisableD rounded-corners";
            cmdActionsEndingSoon.Enabled = false;
            cmdActionsEndingSoon.ControlStyle.CssClass = "DisableD rounded-corners";
            cmdCurrentAuctions.Enabled = false;
            cmdCurrentAuctions.ControlStyle.CssClass = "DisableD rounded-corners";
            cmdCreateAuction.Enabled = false;
            cmdCreateAuction.ControlStyle.CssClass = "DisableD rounded-corners";
            cmdAccountManagement.Enabled = false;
            cmdAccountManagement.ControlStyle.CssClass = "DisableD rounded-corners";
        }
        else
        {
            cmdBrowse.Enabled = true;
            cmdBrowse.ControlStyle.CssClass = "button rounded-corners";
            cmdActionsEndingSoon.Enabled = true;
            cmdActionsEndingSoon.ControlStyle.CssClass = "button rounded-corners";
            cmdCurrentAuctions.Enabled = true;
            cmdCurrentAuctions.ControlStyle.CssClass = "button rounded-corners";
            cmdAccountManagement.Enabled = true;
            cmdAccountManagement.ControlStyle.CssClass = "button rounded-corners";
            if (Session["AccountType"].ToString() == "S")
            {
                cmdCreateAuction.Enabled = true;
                cmdCreateAuction.ControlStyle.CssClass = "button rounded-corners";
            }
            else
            {
                cmdCreateAuction.Enabled = false;
                cmdCreateAuction.Visible = false;
                cmdCreateAuction.ControlStyle.CssClass = "DisableD rounded-corners";
            }

        }

        
        
    }//end Page_Load


    protected void addButton_Command(object sender, CommandEventArgs e)
    {
        
    }//end addButton_Command


    protected void setGridView1AddButtons()
    {
       
    }
    protected void GridView1_PreRender(object sender, EventArgs e)
    {
        setGridView1AddButtons();
    }

    protected void titleLink_Command(object sender, CommandEventArgs e)
    {
        Response.Redirect("Details.aspx?isbn=" + e.CommandArgument.ToString());
    }

    protected void cmdCreateAuction_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/CreateAuction.aspx");
    }
    protected void cmdAccountManagement_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/AccountManagement.aspx");
    }
}
